<?php class Defensesinfo { 

    /***
     * DB Fields: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $id;

    /***
     * DB Fields: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $name;

    /***
     * DB Fields: description
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $description;

    /***
     * DB Fields: image
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $image;

    /***
     * DB Fields: order
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $order;

    /***
     * DB Fields: structure
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $structure;

    /***
     * DB Fields: shield
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $shield;

    /***
     * DB Fields: damage
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $damage;

    /***
     * DB Fields: priceMetal
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $priceMetal;

    /***
     * DB Fields: priceCrystal
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $priceCrystal;

    /***
     * DB Fields: priceDeuterium
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $priceDeuterium;

//--------------- GET METHODS ----------------------------- //
    /***
     * Get value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result id
     **/
    function get_id( ) {
        // returns the value of id
        return $this->id;
    }


    /***
     * Get value for field: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result name
     **/
    function get_name( ) {
        // returns the value of name
        return $this->name;
    }


    /***
     * Get value for field: description
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result description
     **/
    function get_description( ) {
        // returns the value of description
        return $this->description;
    }


    /***
     * Get value for field: image
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result image
     **/
    function get_image( ) {
        // returns the value of image
        return $this->image;
    }


    /***
     * Get value for field: order
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result order
     **/
    function get_order( ) {
        // returns the value of order
        return $this->order;
    }


    /***
     * Get value for field: structure
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result structure
     **/
    function get_structure( ) {
        // returns the value of structure
        return $this->structure;
    }


    /***
     * Get value for field: shield
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result shield
     **/
    function get_shield( ) {
        // returns the value of shield
        return $this->shield;
    }


    /***
     * Get value for field: damage
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result damage
     **/
    function get_damage( ) {
        // returns the value of damage
        return $this->damage;
    }


    /***
     * Get value for field: priceMetal
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result priceMetal
     **/
    function get_priceMetal( ) {
        // returns the value of priceMetal
        return $this->priceMetal;
    }


    /***
     * Get value for field: priceCrystal
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result priceCrystal
     **/
    function get_priceCrystal( ) {
        // returns the value of priceCrystal
        return $this->priceCrystal;
    }


    /***
     * Get value for field: priceDeuterium
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result priceDeuterium
     **/
    function get_priceDeuterium( ) {
        // returns the value of priceDeuterium
        return $this->priceDeuterium;
    }


//--------------- SET METHODS ----------------------------- //
    /***
     * Set value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function set_id( $id ) {
        // sets the value of id
        $this->id = $id;
    }

    /***
     * Set value for field: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param name
     * @result void
     **/
    function set_name( $name ) {
        // sets the value of name
        $this->name = $name;
    }

    /***
     * Set value for field: description
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param description
     * @result void
     **/
    function set_description( $description ) {
        // sets the value of description
        $this->description = $description;
    }

    /***
     * Set value for field: image
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param image
     * @result void
     **/
    function set_image( $image ) {
        // sets the value of image
        $this->image = $image;
    }

    /***
     * Set value for field: order
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param order
     * @result void
     **/
    function set_order( $order ) {
        // sets the value of order
        $this->order = $order;
    }

    /***
     * Set value for field: structure
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param structure
     * @result void
     **/
    function set_structure( $structure ) {
        // sets the value of structure
        $this->structure = $structure;
    }

    /***
     * Set value for field: shield
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param shield
     * @result void
     **/
    function set_shield( $shield ) {
        // sets the value of shield
        $this->shield = $shield;
    }

    /***
     * Set value for field: damage
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param damage
     * @result void
     **/
    function set_damage( $damage ) {
        // sets the value of damage
        $this->damage = $damage;
    }

    /***
     * Set value for field: priceMetal
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param priceMetal
     * @result void
     **/
    function set_priceMetal( $priceMetal ) {
        // sets the value of priceMetal
        $this->priceMetal = $priceMetal;
    }

    /***
     * Set value for field: priceCrystal
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param priceCrystal
     * @result void
     **/
    function set_priceCrystal( $priceCrystal ) {
        // sets the value of priceCrystal
        $this->priceCrystal = $priceCrystal;
    }

    /***
     * Set value for field: priceDeuterium
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param priceDeuterium
     * @result void
     **/
    function set_priceDeuterium( $priceDeuterium ) {
        // sets the value of priceDeuterium
        $this->priceDeuterium = $priceDeuterium;
    }

//--------------- CRUD METHODS ----------------------------- //
    /***
     * Create a new Record: defensesinfo
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param name
     * @param description
     * @param image
     * @param order
     * @param structure
     * @param shield
     * @param damage
     * @param priceMetal
     * @param priceCrystal
     * @param priceDeuterium
     * @result void
     **/
    function createnew_defensesinfo( $id, $name, $description, $image, $order, $structure, $shield, $damage, $priceMetal, $priceCrystal, $priceDeuterium ) {

        // items to be inserted in the database 
        $_obj = array($id,
                      $name,
                      $description,
                      $image,
                      $order,
                      $structure,
                      $shield,
                      $damage,
                      $priceMetal,
                      $priceCrystal,
                      $priceDeuterium); 

        // database object connection
        $dbConn = $GLOBALS['dbConn'];

        // perform insert in the database
        $dbConn->insert("defensesinfo", $_obj);
    }

    /***
     * Retrived an existing record: defensesinfo
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result new Defensesinfo
     **/
    function get_defensesinfo( $id ) {

        // retrive the data
        $dbConn = $GLOBALS['dbConn'];

        // retrieved value in the database
        $_resultSet = $dbConn->doQuery("SELECT * FROM defensesinfo WHERE id = '$id'");

        $__defensesinfoObj = new defensesinfo();
        // return the retrived from the database

        // create a new object
        $__obj = new Defensesinfo();
        $__obj->set_id($_resultSet[0]['id']);
        $__obj->set_name($_resultSet[0]['name']);
        $__obj->set_description($_resultSet[0]['description']);
        $__obj->set_image($_resultSet[0]['image']);
        $__obj->set_order($_resultSet[0]['order']);
        $__obj->set_structure($_resultSet[0]['structure']);
        $__obj->set_shield($_resultSet[0]['shield']);
        $__obj->set_damage($_resultSet[0]['damage']);
        $__obj->set_priceMetal($_resultSet[0]['priceMetal']);
        $__obj->set_priceCrystal($_resultSet[0]['priceCrystal']);
        $__obj->set_priceDeuterium($_resultSet[0]['priceDeuterium']);


        return $__obj;
    }

    /***
     * Update an existing record: defensesinfo
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param itemsToBeUpdated = array()
     * @result void
     **/
    function update_defensesinfo( $id, $itemsToBeUpdated = array() ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs update in the database
         foreach($itemsToBeUpdated as $_fName => $_fVal) { 
               $dbConn->addValuePair($_fName, $_fVal);
         }

         // perform update operation
         $dbConn->update("defensesinfo", "id = '$id'");
    }

    /***
     * Delete an existing record: defensesinfo
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function delete_defensesinfo( $id ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs deletion of data
         $dbConn->delete("defensesinfo", "id = '$id'");
    }

    /***
     * Retrived list of objects base on a given parameters: defensesinfo
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param conditionalStatement = ''
     * @result collection of objects: Defensesinfo
     **/
    function list_defensesinfo( $conditionalStatement = '' ) {

         $dbConn = $GLOBALS['dbConn'];
         // check if there is a given parameter list
         if(!empty($conditionalStatement)) { 
              $sqlStatement = "SELECT * FROM defensesinfo WHERE $conditionalStatement"; 
         } else { 
              $sqlStatement = "SELECT * FROM defensesinfo";
         }

         // retrieve the values base on the query result
         $__resObj = $dbConn->doQuery($sqlStatement);

         $__collectionOfObjects = array();
         foreach($__resObj as $__rs) { 
            $__newObj = new Defensesinfo();

            $__newObj->set_id($__rs['id']);
            $__newObj->set_name($__rs['name']);
            $__newObj->set_description($__rs['description']);
            $__newObj->set_image($__rs['image']);
            $__newObj->set_order($__rs['order']);
            $__newObj->set_structure($__rs['structure']);
            $__newObj->set_shield($__rs['shield']);
            $__newObj->set_damage($__rs['damage']);
            $__newObj->set_priceMetal($__rs['priceMetal']);
            $__newObj->set_priceCrystal($__rs['priceCrystal']);
            $__newObj->set_priceDeuterium($__rs['priceDeuterium']);

            // add object to collection 
            array_push($__collectionOfObjects, $__newObj);
         }

         // return collection of objects
         return $__collectionOfObjects;
    }

} ?>